VERSION 5.00
Begin VB.Form frmStringTest 
   Caption         =   "String Test"
   ClientHeight    =   2910
   ClientLeft      =   1725
   ClientTop       =   1545
   ClientWidth     =   6585
   LinkTopic       =   "Form1"
   ScaleHeight     =   2910
   ScaleWidth      =   6585
   Begin VB.CommandButton cmdStringClass 
      Caption         =   "String concatenation with StringConcat class"
      Height          =   735
      Left            =   840
      TabIndex        =   1
      Top             =   1560
      Width           =   4935
   End
   Begin VB.CommandButton cmdStandard 
      Caption         =   "String concatenation with standard VB operator"
      Height          =   735
      Left            =   840
      TabIndex        =   0
      Top             =   480
      Width           =   4935
   End
End
Attribute VB_Name = "frmStringTest"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'The following code snippet demonstrates how to use the StringConcat class for
'concatenating small pieces of strings into one big string.
'It also do the same operation with the standard "&" operator.
'You can see that string concatenation with StringConcat class can be much faster than with the standard "&" operator.


Private Sub cmdStandard_Click()
    Dim lIndex          As Long
    Dim strResult       As String
    Dim dblTime         As Double
    
    'The standard VB way to concatenate strings:
    dblTime = Timer
    For lIndex = 1 To 10000
        strResult = strResult & CStr(lIndex) & vbCrLf
    Next
    MsgBox Format(CStr(Timer - dblTime), "0.000") & " seconds"
End Sub

Private Sub cmdStringClass_Click()
    Dim lIndex          As Long
    Dim strResult       As String
    Dim objString       As New StringConcat
    Dim dblTime         As Double
    
    dblTime = Timer
    
    'Concatenating strings using StringConcat class.
    For lIndex = 1 To 10000
        objString.Add CStr(lIndex) & vbCrLf
    Next
    strResult = objString.GetStr
    
    MsgBox Format(CStr(Timer - dblTime), "0.000") & " seconds"
End Sub

